package ssau.knyazev.ocean;

public interface OceanConst {

	String vertexShaderSource ="varying vec3 eyeSpacePos;\n" +
			"varying vec3 worldSpaceNormal;\n" +
			"varying vec3 eyeSpaceNormal;\n" +
			"uniform float heightScale; // = 0.5;\n" +
			"uniform float chopiness;   // = 1.0;\n" +
			"uniform vec2  size;        // = vec2(256.0, 256.0);\n" +
			"\n" +
			"void main()\n" +
			"{" +
			"    float height     = gl_MultiTexCoord0.x;\n" +
			"    vec2  slope      = gl_MultiTexCoord1.xy;\n" +
			"\n" +
			"    // calculate surface normal from slope for shading\n" +
			"	vec3 normal      = normalize(cross( vec3(0.0, slope.y*heightScale, 2.0 / size.x), vec3(2.0 / size.y, slope.x*heightScale, 0.0)));\n" +
			"    worldSpaceNormal = normal;\n" +
			"\n" +
			"    // calculate position and transform to homogeneous clip space\n" +
			"    vec4 pos         = vec4(gl_Vertex.x, height * heightScale, gl_Vertex.z, 1.0);\n" +
			"    gl_Position      = gl_ModelViewProjectionMatrix * pos;\n" +
			"\n" +
			"eyeSpacePos      = (gl_ModelViewMatrix * pos).xyz;\n" +
			"eyeSpaceNormal   = (gl_NormalMatrix * normal).xyz;\n" +
			"}\n";

	String fragmentShaderSource = "varying vec3 eyeSpacePos;\n" +
			"varying vec3 worldSpaceNormal;\n" +
			"varying vec3 eyeSpaceNormal;\n" +
			"" +
			"uniform vec4 deepColor;\n" +
			"uniform vec4 shallowColor;\n" +
			"uniform vec4 skyColor;\n" +
			"uniform vec3 lightDir;\n" +
			"\n" +
			"void main()\n" +
			"{" +
			"    vec3 eyeVector              = normalize(eyeSpacePos);\n" +
			"    vec3 eyeSpaceNormalVector   = normalize(eyeSpaceNormal);\n" +
			"    vec3 worldSpaceNormalVector = normalize(worldSpaceNormal);\n" +
			"    float facing    = max(0.0, dot(eyeSpaceNormalVector, -eyeVector));\n" +
			"    float fresnel   = pow(1.0 - facing, 5.0); // Fresnel approximation\n" +
			"    float diffuse   = max(0.0, dot(worldSpaceNormalVector, lightDir));  \n" +
			"    vec4 waterColor = mix(shallowColor, deepColor, facing);\n" +
			"    gl_FragColor = waterColor*diffuse + skyColor*fresnel;\n" +
			"}\n";
	
	int meshSize = 1024;
	int spectrumW = meshSize + 4;
	int spectrumH = meshSize + 1;
	
	// simulation parameters
	float g = 9.81f; // gravitational constant
	float A = 1e-7f; // wave scale factor
	float patchSize = 75.0f; // patch size
	float windSpeed = 100.0f;
	float windDir = (float) (Math.PI / 3.0f);
	float dirDepend = 0.07f;
	
}
